const sass = require('sass')
const loadGruntTasks = require('load-grunt-tasks')

module.exports = grunt => {
    grunt.initConfig({
        clean:{
            dist: 'dist'
        },
        sass:{
            options:{
                implementation: sass,
                sourceMap: true,
            },
            main:{
                files:[{
                    expand: true,
                    cwd: 'src/assets/styles',
                    src: '*.scss' ,
                    dest: 'dist/assets/styles',
                    ext: '.css'
                }]
            }
        },
        babel:{
            oprions:{
                presets: ['@babel/preset-env']
            },
            main:{
                files:[{
                    expand: true,
                    cwd: 'src/assets/scripts',
                    src: '*.js' ,
                    dest: 'dist/assets/scripts',
                }]
            }
        },
        watch:{
            js:{
                files: ['src/assets/scripts/*.js'],
                task:['babel']
            },
            css:{
                files: ['src/assets/styles/*.scss'],
                task:['sass']
            }

        }
    })

    loadGruntTasks(grunt)

    grunt.registerTask('default', ['clean', 'sass', 'babel', 'watch'])
}